<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--
    在使用class定义类之后 如何实现继承操作  extends  super  方法重写  set  get
-->

<script>

    class Phone {

        constructor(brand, price) {
            this.brand = brand
            this.price = price
        }
        //  打电话
        call(){
            console.log("语音电话")
        }

        sendMsg(){
            console.log("发送短信")
        }
    }

    let phone = new Phone('华为', 2000)
    console.log(phone)


    class HWPhone extends Phone {

        constructor(brand, price, color, model) {
            super(brand, price)
            this.color = color
            this.model = model
        }

        call(){
            console.log("视频电话")
        }

        sendMsg(){
            console.log("发送彩信")
        }
    }

    phone = new HWPhone('华为', 2000,'白色','三折叠')
    console.log(phone)
    console.log(phone.color)
    console.log(phone.brand)
    console.log(phone.price)

    phone.call()
    phone.sendMsg()


</script>
</body>
</html>